package javase.ch03.pool.common;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class NewSinglethreadExcutorDemo {
    public static void main(String[] args) {
        ExecutorService pool = Executors.newSingleThreadExecutor();

        pool.execute(new MyRunnable());
        pool.execute(new MyRunnable());

        //关闭多线程池
        pool.shutdown();
    }
}


class MyRunnable implements Runnable{
    @Override
    public void run() {
            System.out.println(Thread.currentThread().getName());
    }
}